<?php

use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMessagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('messages', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('push_id')->nullable()->comment('发送人');
            $table->integer('user_id')->nullable()->comment('接收人ID 1V1 or 群消息只可被当前用户接收');
            $table->integer('group_id')->nullable()->comment('群ID（1V1时为null）');
            $table->text('content')->nullable()->comment('消息内容');
            $table->tinyInteger('type')->unsigned()->comment('消息类型: 1文本 2图片 3语音 4文件 5表情 6踢出群聊提示 7公告提示 8进群提示 9修改群名称提示 10分享');
            $table->timestamps();

            $table->comment ='消息表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('messages');
    }
}
